package com.ucampus.service;


import com.ucampus.entity.status;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ucampus.dao.statusMapper;

/**
 * 功能：
 * 作者： 启明星_Polaris
 * 日期：2025/1/11 下午2:03
 **/

@Service
public class statusService {
    @Autowired
    private statusMapper statusMapper;

    // 根据 userId 查询状态
    public status getStatusByUserId(long userId) {
        return statusMapper.findStatusByUserId(userId);
    }

    // 根据 userId 修改状态
    public boolean updateStatusByUserId(long userId, String status) {
        int rowsAffected = statusMapper.updateStatusByUserId(userId, status);
        return rowsAffected > 0;
    }
    // 插入记录，仅插入 userId
    public boolean insertUserId(long userId) {
        int rowsAffected = statusMapper.insertUserId(userId);
        return rowsAffected > 0;
    }
}